Now Available!

Native .Net
Components

TList WinForms
for
.Net Framework

&

MetaDraw WinForms
for
.Net Framework



Bennet-Tec
Components
Make you
look sharp!



Home

Company

Products

Order Forms

How To

Downloads

Updates

Support

Registration

Dependencies

Links

Compatibility

Site Map


Basic How To


Loading an RTF or TXT File

It is easy to load a file into ALLText, however ALLText does not support .DOC files as created with MS Word.

View On-Line Sample
Return to main How To Page

Loading text from a File

ALLText makes loading a document simple. You can load a Text, RTF or ATX formatted file using the ALLText I/O stream property, FileLoad. Additionally FileSave may be used to save data to a file.

First set the DataType property to specify the file format: 0 for Raw Text, 1 for ATX_S (does not include font table and is useful only when hardcoding the font table), 2 for ATX_F (includes font table), or 3 for RTF level 1 (HT/Pro edition only) formatted file. Set the FileName property, including the full path to the desired file name. Now, Initiate file loading by setting the FileLoad property to 1 This indicates that ALLText should load the complete file without need of further programmatic intervention.

For Example:

' Set the file name

ALLText1.FileName = "test.TXT"

' set constant def file for constant values

ALLText1.DataType = ATX_FORMAT_TEXT

' Automatically load the file

ALLText1.FileLoad = 1

Or

' Set the file name

ALLText1.FileName = "test.RTF"

' set constant def file for constant values

ALLText1.DataType = ATX_FORMAT_RTF

'Automatically load the file

ALLText1.FileLoad = 1

Other settings of the FileLoad property invoke the ATXGet event to allow greater programmatic control. These are somewhat more involved and are discussed in the section dedicated to ALLText Low Level I/O.

Note that you may want to prevent end-user interaction during the load procedure by setting the WriteProtect property to TRUE (-1) prior to the FileLoad statement, and returning to a value of False (0) upon completion.

PLEASE NOTE - File I/O has side effects, ALLText internally prevents reading or writing of certain properties during I/O. Closing the ALLText window or an application during running of I/O may lead to errors.

When reading a large file, ALLText will immediately interpret only enough of the formatting to display to fill the control window. Formatting then continues as a background process. It is possible to identify to track the progress of background formatting by reading the TextFormatted property. TextFormatted returns TRUE when all the formatting has been completed, or a Long Integer value representing the number of paragraphs currently processed. Setting TextFormatted to True will force ALLText to complete the current text formatting process before continuing.

It is IMPORTANT to recognize that until formatting has been completed, properties such as DocHeight which depend on the complete document formatting, will not be reliable.


Copyright© 2003 Bennet-Tec Information Systems, Inc. All rights reserved.